-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add Qt5/6 compatibility typedef for qHash seed type #4292
Conversation
src/util/qhash.h
Outdated
@@ -0,0 +1,5 @@ | |||
#if QT_VERSION <= QT_VERSION_CHECK(6, 0, 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nitpick: Please use >=
and exchange the arms. The legacy code should be in the 2nd arm. That's how we do it usually, just search for QT_VERSION_CHECK. Will prevent mistakes when removing the conditionals in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Somehow that doesn't build??
#if QT_VERSION_CHECK(6, 0, 0) >= QT_VERSION
typedef size_t qhash_seed_t;
#else
typedef uint qhash_seed_t;
#endif
../src/track/trackref.h:137:18: error: call of overloaded ‘qHash(const TrackId&, qhash_seed_t&)’ is ambiguous
137 | qHash(key.getId(), seed);
| ~~~~~^~~~~~~~~~~~~~~~~~~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
;)
src/controllers/midi/midimessage.h
Outdated
@@ -8,6 +8,7 @@ | |||
#include <cstdint> | |||
|
|||
#include "preferences/usersettings.h" | |||
#include "util/qhash.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we have a compatibility.h
header file that we should use instead of adding a new header for each Qt6 class. Or maybe add a single new qtcompat.h
file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A single file would pull in many unused Qt dependencies. We already have qtmutex.h
.
We should definitely agree on some pattern. Introducing a new subdirectory util/qtcompat
with separate header files could also be an option.
I guess the the directory is a good start. We can migrate the existing hacks and workarounds step by step. LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
https://doc-snapshots.qt.io/qt6-6.2/qtcore-changes-qt6.html#qhash-signature